package Main.BS;


import Main.BS.dao.ContactDao;
import Main.BS.entity.Contact;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.IOException;
import java.util.List;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:Main/BS/applicationContext.xml")
public class test {
    @Autowired
      ContactDao contactMapper;


    @Test
    public  void test() throws IOException {
        Contact contact = new Contact();
        contact.setCcode(1111);
        contact.setCname("wuwu");
        contact.setCaddress("hu");
        contact.setCphone("199");
        contactMapper.contactAdd(contact);
        List<Contact> list=contactMapper.contactSelectByName("wuwu");
        System.out.println(list);
        contact.setCname("hhn");
        contactMapper.contactUpdate(contact);
        contact.setCname("h");
        contactMapper.contactUpdate(contact);
        List<Contact> list1=contactMapper.contactSelectAll();
        System.out.println(list1);
//        contactMapper.contactDelete(1111);
    }

}
